<!-- $Id: article_info.htm 16780 2009-11-09 09:28:30Z sxc_shop $ -->

<?php echo $this->fetch('pageheader.htm'); ?> <?php echo $this->smarty_insert_scripts(array('files'=>'../js/utils.js,selectzone.js,validator.js')); ?>

<!-- start goods form -->

<div class="tab-div">

	<div id="tabbar-div">

		<p>

			<span class="tab-front" id="general-tab"><?php echo $this->_var['lang']['tab_general']; ?></span>
			<?php if ($this->_var['form_action'] == "insert" || ( $this->_var['article']['content'] ) || ( ! $this->_var['article']['content'] && ! count ( $this->_var['img_list'] ) )): ?><span class="tab-back" id="detail-tab"><?php echo $this->_var['lang']['tab_content']; ?></span><?php endif; ?>
			<?php if ($this->_var['article']['content'] && $this->_var['image_list']): ?><span class="tab-back" id="images-tab"><?php echo $this->_var['lang']['tab_images']; ?></span><?php endif; ?>			
			<?php if ($this->_var['form_action'] == "insert" || ! $this->_var['article']['content']): ?><span class="tab-back" id="addimg-tab"><?php echo $this->_var['lang']['tab_addimg']; ?></span><?php endif; ?>
			<!--<span class="tab-back" id="imglist-tab"><?php echo $this->_var['lang']['tab_imglist']; ?></span>-->			
			<?php if ($this->_var['form_action'] == "update"): ?><span class="tab-back" id="goods-tab"><?php echo $this->_var['lang']['tab_goods']; ?></span>
			<span class="tab-back" id="article-tab"><?php echo $this->_var['lang']['tab_articles']; ?></span><?php endif; ?>
			<!--<span class="tab-back" id="copyright-tab"><?php echo $this->_var['lang']['tab_copyright']; ?></span>-->
		</p>

	</div>

	<div id="tabbody-div">

		<form action="article.php" method="post" enctype="multipart/form-data" name="theForm" onsubmit="return validate();">

			<table width="90%" id="general-table">

				<tr>

					<td class="narrow-label"><?php echo $this->_var['lang']['title']; ?></td>

					<td><input type="text" name="title" size="40" maxlength="60" value="<?php echo htmlspecialchars($this->_var['article']['title']); ?>" placeholder="字数控制在15字内" /><?php echo $this->_var['lang']['require_field']; ?></td>

				</tr>
				<tr>

					<td class="narrow-label">文章副标题</td>

					<td>
						<input type="text" name="subtitle" size="40" maxlength="60" value="<?php echo htmlspecialchars($this->_var['article']['subtitle']); ?>" placeholder="字数控制在18字内" />
					</td>

				</tr>
				<tr >

					<td class="narrow-label"><?php echo $this->_var['lang']['lable_description']; ?></td>

					<td>
						<input type="text" name="description" id="description" size="70" maxlength="100" placeholder="(文章简介尽量用一句话点评，字数限制为34字)" value="<?php echo htmlspecialchars($this->_var['article']['description']); ?>" /><?php echo $this->_var['lang']['require_field']; ?>
					</td>

				</tr>
				<tr>

					<td class="narrow-label"><?php echo $this->_var['lang']['author']; ?></td>

					<td>
						<?php if ($this->_var['article']['admin_name'] == ''): ?>
						<input type="hidden" name="admin_name" maxlength="60" value="<?php echo sub_str($_SESSION['admin_name'],10); ?>" placeholder="默认值为发布者昵称"/>
						<?php else: ?>
						<input type="hidden" name="admin_name" maxlength="60" value="<?php echo htmlspecialchars($this->_var['article']['admin_name']); ?>" placeholder="默认值为发布者昵称"/>
						<?php endif; ?>
						<input type="text" name="author" maxlength="60"  value="<?php echo htmlspecialchars($this->_var['article']['author']); ?>" placeholder="默认值为发布者昵称"/>
					</td>

				</tr>				
				<tr>

					<td class="narrow-label"><?php echo $this->_var['lang']['keywords']; ?></td>

					<td>
						<input type="text" id="keywords" name="keywords"size="40" maxlength="60" value="<?php echo htmlspecialchars($this->_var['article']['keywords']); ?>" placeholder="关键字用于文章搜索，请认真填写"/><?php echo $this->_var['lang']['require_field']; ?>
						<span class="notice-span">每个关键字用空格区分</span>
					</td>

				</tr>
				<tr>

					<td class="narrow-label"></td>

					<td>
						<div>我用过的关键字</div>
						<div style="padding-right: 420px;">
						<?php $_from = $this->_var['getkeywords']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'var');if (count($_from)):
    foreach ($_from AS $this->_var['var']):
?>
						
						<span onclick="getkeyword('<?php echo $this->_var['var']['keyword']; ?>')" style="color: #006ACD;margin-left: 5px;">  <?php echo $this->_var['var']['keyword']; ?>  </span>
						
						<?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
						</div>
					</td>

				</tr>

				

				<!-- <?php if ($this->_var['article']['cat_id'] >= 0): ?> -->

				<tr>

					<td class="narrow-label"><?php echo $this->_var['lang']['cat']; ?> </td>

					<td>

						<select name="article_cat" id="article_cat" onchange="catChanged()">

							<option value="0"><?php echo $this->_var['lang']['select_plz']; ?></option>

							<?php echo $this->_var['cat_select']; ?>

						</select>

						<?php echo $this->_var['lang']['require_field']; ?></td>

				</tr>

				<!-- <?php else: ?> -->

				<!--<input type="hidden" name="article_cat" value="-1" />-->

				<!-- <?php endif; ?> -->

				<?php if ($this->_var['article']['cat_id'] >= 0): ?>

				<tr>

					<td class="narrow-label"><?php echo $this->_var['lang']['article_type']; ?></td>

					<td>
						<input type="radio" name="article_type" value="0" <?php if ($this->_var['article']['article_type'] == 0): ?>checked<?php endif; ?>><?php echo $this->_var['lang']['common']; ?>

						<input type="radio" name="article_type" value="1" <?php if ($this->_var['article']['article_type'] == 1): ?>checked<?php endif; ?>><?php echo $this->_var['lang']['top']; ?> <?php echo $this->_var['lang']['require_field']; ?> </td>

				</tr>

				<tr>

					<td class="narrow-label"><?php echo $this->_var['lang']['is_open']; ?></td>

					<td>

						<input type="radio" name="is_open" value="1" <?php if ($this->_var['article']['is_open'] == 1): ?>checked<?php endif; ?>> <?php echo $this->_var['lang']['isopen']; ?>

						<input type="radio" name="is_open" value="0" <?php if ($this->_var['article']['is_open'] == 0): ?>checked<?php endif; ?>> <?php echo $this->_var['lang']['isclose']; ?>

						<!--<input type="radio" name="is_open" value="2" <?php if ($this->_var['article']['is_open'] == 2): ?>checked<?php endif; ?>> 常见问题<?php echo $this->_var['lang']['require_field']; ?> </td>-->

				</tr>

				<?php else: ?>

				<tr style="display:none">

					<td colspan="2">
						<input type="hidden" name="article_type" value="0" />
						<input type="hidden" name="is_open" value="1" />
					</td>

				</tr>

				<?php endif; ?>

				<tr>

					<td class="narrow-label">是否热门文章</td>

					<td>
						<input type="radio" name="is_hot" value="0" <?php if ($this->_var['article']['is_hot'] == 0): ?>checked<?php endif; ?>> 否

						<input type="radio" name="is_hot" value="1" <?php if ($this->_var['article']['is_hot'] == 1): ?>checked<?php endif; ?>>是

					</td>

				</tr>

				<tr style="display: none;">

					<td class="label">文章缩略图</td>

					<td>

						<input type="file" name="article_thumb" size="35" /> <?php if ($this->_var['article']['article_thumb']): ?>

						</br>

						<a href="../<?php echo $this->_var['article']['article_thumb']; ?>" target="_blank">

							<img height=50 src="../<?php echo $this->_var['article']['article_thumb']; ?>" style="margin:5px 0;" border="0" />

						</a>

						<?php else: ?>

						<img src="images/no.gif" /> <?php endif; ?>

						</br><span class="notice-span">比例为：宽*高 120px*80px</span>

					</td>

				</tr>

				<tr>

					<td class="narrow-label">文章缩略图
						<!--<?php echo $this->_var['lang']['upload_file']; ?>-->
					</td>

					<td>
						<input type="file" id="file" name="file"> <?php if ($this->_var['article']['file_url']): ?>

						<img src="images/yes.gif" /> <?php else: ?>

						<img src="images/no.gif" /> <?php endif; ?>
						<span class="narrow-label"><!--<?php echo $this->_var['lang']['file_url']; ?>--><?php echo $this->_var['lang']['require_field']; ?>

          <input name="file_url" id="file_url" type="hidden" value="<?php echo htmlspecialchars($this->_var['article']['file_url']); ?>" size="30" maxlength="255" />

          </span>
						</br><span class="notice-span">比例为：宽*高 256px*256px</span>
						
					</td>

				</tr>
				<tr id="video_url" style="display: none;">

					<td class="narrow-label">视频预览图
						<!--<?php echo $this->_var['lang']['upload_file']; ?>-->
					</td>

					<td>
						<input type="file" id="img" name="img" > <?php if ($this->_var['article']['img_url']): ?>

						<img src="images/yes.gif" /> <?php else: ?>

						<img src="images/no.gif" /> <?php endif; ?>
						<span class="narrow-label"><!--<?php echo $this->_var['lang']['file_url']; ?>--><?php echo $this->_var['lang']['require_field']; ?>
							
				          <input name="img_url" id="img_url" type="hidden" value="<?php echo htmlspecialchars($this->_var['article']['img_url']); ?>" size="30" maxlength="255" />
		          </span>
								</br><span class="notice-span">比例为：宽*高 1080*720</span>
							</td>

				</tr>
				<tr id="video_link" style="display: none;">

					<td class="narrow-label"><?php echo $this->_var['lang']['external_links']; ?></td>

					<td>
						<input name="link_url" type="text" id="link_url" value="<?php echo htmlspecialchars($this->_var['article']['link']); ?>" size="40" maxlength="200" />
					</td>

				</tr>				

				<tr style="display: none;">

					<td class="narrow-label"><?php echo $this->_var['lang']['email']; ?></td>

					<td>
						<input type="text" name="author_email" maxlength="60" value="<?php echo htmlspecialchars($this->_var['article']['author_email']); ?>" />
					</td>

				</tr>
				<tr>
					<td class="narrow-label"><?php echo $this->_var['lang']['copyright_right']; ?></td>

					<td><input  type="radio" onclick="original(0)" name="is_original" checked value="0"/>无
						<?php $_from = $this->_var['getcopyright_type']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'type_list');if (count($_from)):
    foreach ($_from AS $this->_var['type_list']):
?>
							<input type="radio" onclick="original(<?php echo $this->_var['type_list']['copyright_type_id']; ?>)" name="is_original" value="<?php echo $this->_var['type_list']['copyright_type_id']; ?>" <?php if ($this->_var['article']['copyright_type'] == $this->_var['type_list']['copyright_type_id']): ?>checked<?php endif; ?>><?php echo $this->_var['type_list']['copyright_name']; ?>  
						<?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
						<!--<input type="radio" onclick="original(0)" name="is_original" value="0" <?php if ($this->_var['article']['is_original'] == 0): ?>checked<?php endif; ?>> <?php echo $this->_var['lang']['original_none']; ?>

						<input type="radio" onclick="original(1)" name="is_original" value="1" <?php if ($this->_var['article']['is_original'] == 1): ?>checked<?php endif; ?>> <?php echo $this->_var['lang']['original']; ?>

						<input type="radio" onclick="original(2)" name="is_original" value="2" <?php if ($this->_var['article']['is_original'] == 2): ?>checked<?php endif; ?>> <?php echo $this->_var['lang']['reprinted']; ?> -->
					</td>

				</tr>
				<tr id="original"  style="display:none">

			
					<td class="narrow-label">声明内容</td>

					<td>
						<p id="original-content"></p>
					</td>

				</tr>
				<tr id="code_logo" style="display:none">
					<td class="narrow-label">图片</td>

					<td>
						<div id="code_logo_img"></div>
					</td>

				</tr>
				<tr id="reprinted" style="display:none">
					<td class="narrow-label">转载地方</td>

					<td>
						<input type="text" id="reprinted_name" name="reprinted" value="<?php echo $this->_var['article']['original_content']; ?>" > 
					</td>

				</tr>

				<!--<tr>

					<td class="narrow-label"><?php echo $this->_var['lang']['keywords']; ?></td>

					<td>
						<input type="text" name="keywords" maxlength="60" value="<?php echo htmlspecialchars($this->_var['article']['keywords']); ?>" />
					</td>

				</tr>

				<tr >

					<td class="narrow-label"><?php echo $this->_var['lang']['lable_description']; ?></td>

					<td>
						<textarea name="description" id="description" cols="40" rows="5"><?php echo htmlspecialchars($this->_var['article']['description']); ?></textarea>
					</td>

				</tr>-->

			</table>

			<table width="90%" id="detail-table" style="display:none">

				<tr>
					<td><?php echo $this->_var['FCKeditor']; ?></td>
				</tr>

			</table>
		<table width="90%" id="article-table" style="display:none" align="center">

          <!-- 鏂囩珷鎼滅储 -->

          <tr>

            <td colspan="3">

              <img src="images/icon_search.gif" width="26" height="22" border="0" alt="SEARCH" />

              <?php echo $this->_var['lang']['article_title']; ?> <input type="text" name="article_title" />

              <input type="button" value="<?php echo $this->_var['lang']['button_search']; ?>" onclick="searchArticle()" class="button" />

            </td>

          </tr>

          <!-- 鏂囩珷鍒楄〃 -->

          <tr>

            <th><?php echo $this->_var['lang']['all_article']; ?></th>

            <th><?php echo $this->_var['lang']['handler']; ?></th>

            <th><?php echo $this->_var['lang']['goods_article']; ?></th>

          </tr>

          <tr>

            <td width="45%">

              <select name="source_select3" size="20" style="width:100%" multiple ondblclick="sz3.addItem(false, 'add_link_article', articleId)">

              </select>

            </td>

            <td align="center">

              <p ><input type="button" value=">>" onclick="sz3.addItem(true, 'add_link_article', articleId)" class="button" /></p>

              <p ><input type="button" value=">" onclick="sz3.addItem(false, 'add_link_article', articleId)" class="button" /></p>

              <p><input type="button" value="<" onclick="sz3.dropItem(false, 'drop_link_article', articleId)" class="button" /></p>

              <p><input type="button" value="<<" onclick="sz3.dropItem(true, 'drop_link_article', articleId)" class="button" /></p>

            </td>

            <td width="45%">

              <select name="target_select3" id='article_link' size="20" style="width:100%" multiple ondblclick="sz3.dropItem(false, 'drop_link_article', articleId)">

                <?php $_from = $this->_var['goods_article_list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'goods_article');if (count($_from)):
    foreach ($_from AS $this->_var['goods_article']):
?>

                <option value="<?php echo $this->_var['goods_article']['article_id']; ?>"><?php echo $this->_var['goods_article']['title']; ?></option>

                <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>

              </select>

            </td>

          </tr>

        </table>

		<table width="90%" id="images-table" style="display:none">
          <tr>
            <td>
				<div style="width: 100%;padding:10px;"><span style='width:85%;float:left;font-size: 15px;'><?php echo htmlspecialchars($this->_var['article']['title']); ?></span>[共有 <span style="color: red;"><?php echo $this->_var['img_count']; ?></span> 张图片]</div>
            	
            <?php $_from = $this->_var['image_list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('k', 'img');if (count($_from)):
    foreach ($_from AS $this->_var['k'] => $this->_var['img']):
?>
            
              <div style="float:left; text-align:center; border: 1px solid #DADADA; margin: 4px; padding:2px;">

                <a href="goods.php?act=show_image&img_url=<?php echo $this->_var['img']['url']; ?>" target="_blank">

                <img src="<?php echo $this->_var['img']['url']; ?>" width="240" height="160" border="0" />
                
                </a><br />
				<input type="hidden" value="<?php echo $this->_var['img']['url']; ?>" name="img_tips_name[]" />				
                <textarea name="img_tips[]" cols="25" rows="5" placeholder="请输入70个汉字以内的图片文字简介！" ><?php echo $this->_var['img']['desc']; ?></textarea>
              </div>
			<?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
            </td>

          </tr>

          <tr><td>&nbsp;</td></tr>


        </table>



			<table width="90%" id="addimg-table" style="display:none">
				
				<tr>
				<td>
					<?php $_from = $this->_var['img_list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('i', 'img');if (count($_from)):
    foreach ($_from AS $this->_var['i'] => $this->_var['img']):
?>
			
					<div id="gallery_<?php echo $this->_var['img']['img_id']; ?>" style="float:left; text-align:center; border: 1px solid #DADADA; margin: 4px; padding:2px;width: 270px;height: 300px;">

						排序：<input type="text" value="<?php echo $this->_var['img']['sort_order']; ?>" size="5" name="old_img_sort[<?php echo $this->_var['img']['img_id']; ?>]" />			
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:;" onclick="if (confirm('<?php echo $this->_var['lang']['drop_img_confirm']; ?>')) dropImg('<?php echo $this->_var['img']['img_id']; ?>')">【X】</a>
						<br />
			
						<a href="goods.php?act=show_image&img_url=<?php echo $this->_var['oss_host']; ?><?php echo $this->_var['img']['img_url']; ?>" target="_blank">
			
							<!--                <img src="<?php echo $this->_var['oss_host']; ?><?php if ($this->_var['img']['thumb_url']): ?><?php echo $this->_var['img']['thumb_url']; ?><?php else: ?><?php echo $this->_var['img']['img_url']; ?><?php endif; ?>" <?php if ($this->_var['thumb_width'] != 0): ?>width="<?php echo $this->_var['thumb_width']; ?>"<?php endif; ?> <?php if ($this->_var['thumb_height'] != 0): ?>height="<?php echo $this->_var['thumb_height']; ?>"<?php endif; ?> border="0" />-->
							<img src="<?php echo $this->_var['oss_host']; ?><?php echo $this->_var['img']['img_url']; ?>" width="270" border="0" />
			
						</a>
						<br />
						<div><?php echo htmlspecialchars($this->_var['img']['img_desc']); ?></div>
<!--						<div><?php echo $this->_var['img']['add_time']; ?></div>-->
			
					</div>
			
					<?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
			
				</td>
				</tr>
				<tr>

            <td>

              <a href="javascript:;" onclick="addImg(this)">[+]</a>

             <!-- <?php echo $this->_var['lang']['img_desc']; ?> -->
             <!--<input type="hidden" name="img_desc[]" size="20" />-->

              <?php echo $this->_var['lang']['img_url']; ?> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="file" name="img_url[]" />
							<?php echo $this->_var['lang']['img_url']; ?>
							<br />
              <!--<input type="text" size="40" value="<?php echo $this->_var['lang']['img_file']; ?>" style="color:#aaa;" onfocus="if (this.value == '<?php echo $this->_var['lang']['img_file']; ?>'){this.value='http://';this.style.color='#000';}" name="img_file[]"/>-->						
							<textarea name="img_desc[]" cols="80" rows="3"></textarea>
            </td>
            
				</tr>
				<tr><td>&nbsp;</td></tr>
			</table>

			
			<table width="90%" id="goods-table" style="display:none">

				<!-- 商品搜索 -->

				<tr>

					<td colspan="5">

						<img src="images/icon_search.gif" width="26" height="22" border="0" alt="SEARCH" />

						<!-- 分类 -->

						<select name="cat_id">
							<option value="0"><?php echo $this->_var['lang']['all_category']; ?></caption><?php echo $this->_var['goods_cat_list']; ?></select>

						<!-- 品牌 -->

						<select name="brand_id">
							<option value="0"><?php echo $this->_var['lang']['all_brand']; ?></caption><?php echo $this->html_options(array('options'=>$this->_var['brand_list'])); ?></select>

						<!-- 关键字 -->

						<input type="text" name="keyword" size="30" />

						<input type="button" value="<?php echo $this->_var['lang']['button_search']; ?>" onclick="searchGoods()" class="button" />

						<td>

				</tr>

				<!-- 商品列表 -->

				<tr>

					<th><?php echo $this->_var['lang']['all_goods']; ?></th>

					<th><?php echo $this->_var['lang']['handler']; ?></th>

					<th><?php echo $this->_var['lang']['send_bouns_goods']; ?></th>

				</tr>

				<tr>

					<td width="45%" align="center">

						<select name="source_select" size="20" style="width:90%" ondblclick="sz.addItem(false, 'add_link_goods', articleId)" multiple="true">

						</select>

					</td>

					<td align="center">

						<p>
							<input type="button" value="&gt;&gt;" onclick="sz.addItem(true, 'add_link_goods', articleId)" class="button" />
						</p>

						<p>
							<input type="button" value="&gt;" onclick="sz.addItem(false, 'add_link_goods', articleId)" class="button" />
						</p>

						<p>
							<input type="button" value="&lt;" onclick="sz.dropItem(false, 'drop_link_goods', articleId)" class="button" />
						</p>

						<p>
							<input type="button" value="&lt;&lt;" onclick="sz.dropItem(true, 'drop_link_goods', articleId)" class="button" />
						</p>

					</td>

					<td width="45%" align="center">

						<select name="target_select" id="goods_link" multiple="true" size="20" style="width:90%" ondblclick="sz.dropItem(false, 'drop_link_goods', articleId)">

							<?php $_from = $this->_var['goods_list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'goods');if (count($_from)):
    foreach ($_from AS $this->_var['goods']):
?>

							<option value="<?php echo $this->_var['goods']['goods_id']; ?>"><?php echo $this->_var['goods']['goods_name']; ?></option>

							<?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>

						</select>

					</td>

				</tr>

			</table>
			
			<!--<table width="90%" id="copyright-table" style="display:none">
				<tr>
					<td class="narrow-label"><?php echo $this->_var['lang']['is_open']; ?></td>

					<td>

						<input type="radio" onclick="original(0)" name="is_original" value="0" <?php if ($this->_var['article']['is_original'] == 0): ?>checked<?php endif; ?>> <?php echo $this->_var['lang']['original_none']; ?>

						<input type="radio" onclick="original(1)" name="is_original" value="1" <?php if ($this->_var['article']['is_original'] == 1): ?>checked<?php endif; ?>> <?php echo $this->_var['lang']['original']; ?>

						<input type="radio" onclick="original(2)" name="is_original" value="2" <?php if ($this->_var['article']['is_original'] == 2): ?>checked<?php endif; ?>> <?php echo $this->_var['lang']['reprinted']; ?> 
					</td>

				</tr>
				<tr id="original" 	 style="display:none" >

			
					<td class="narrow-label">声明内容</td>

					<td>
						<p id="original-content"></p>
					</td>

				</tr>
				<tr id="code_logo" style="display:none">
					<td class="narrow-label">二维码</td>

					<td>
						<div id="code_logo_img"></div>
					</td>

				</tr>
				<tr id="reprinted" style="display:none">
					<td class="narrow-label">转载地方</td>

					<td>
						<input type="text" name="reprinted" value="<?php echo $this->_var['article']['original_content']; ?>" > 
					</td>

				</tr>
			</table>-->
			<div class="button-div" >

				<input type="hidden" name="act" value="<?php echo $this->_var['form_action']; ?>" />

				<input type="hidden" name="old_title" value="<?php echo $this->_var['article']['title']; ?>" />
				
				<input type="hidden" name="id" value="<?php echo $this->_var['article']['article_id']; ?>" />

				<input type="submit" value="<?php echo $this->_var['lang']['button_submit']; ?>" class="button" />

				<input type="reset" value="<?php echo $this->_var['lang']['button_reset']; ?>" class="button" />

			</div>

		</form>

	</div>

</div>

<!-- end goods form -->

<script language="JavaScript">
	var copyright_id = 0;
	<?php if ($this->_var['article']['copyright_type'] == 1): ?>
		original(1);
		copyright_id=<?php echo $this->_var['article']['copyright_id']; ?>;
	<?php endif; ?>
	<?php if ($this->_var['article']['copyright_type'] == 2): ?>
		original(2);
		copyright_id=<?php echo $this->_var['article']['copyright_id']; ?>;
	<?php endif; ?>
	<?php if ($this->_var['article']['copyright_type'] == 3): ?>
		original(3);
		copyright_id=<?php echo $this->_var['article']['copyright_id']; ?>;
	<?php endif; ?>
	<?php if ($this->_var['article']['copyright_type'] == 4): ?>
		original(4);
		copyright_id=<?php echo $this->_var['article']['copyright_id']; ?>;
	<?php endif; ?>

	getCatType(<?php echo $this->_var['article']['cat_id']; ?>);

//	alert(str);
	var articleId = <?php echo empty($this->_var['article']['article_id']) ? '0' : $this->_var['article']['article_id']; ?>;
	
	var copyright;
	
	var elements  = document.forms['theForm'].elements;
	
	 var sz1 = new SelectZone(1, elements['source_select1'], elements['target_select1']);

	 var sz2 = new SelectZone(2, elements['source_select2'], elements['target_select2'], elements['price2']);
	
	 var sz3 = new SelectZone(1, elements['source_select3'], elements['target_select3']);
	
	var sz        = new SelectZone(1, elements['source_select'], elements['target_select'], '');
	
	
	
	
	
	onload = function()
	
	{
	
	  // 开始检查订单
	
	  startCheckOrder();
	  	var str=location.href;
		var num=str.indexOf("&set=") ;
		str =str.substr(num+5,7);
		if(str=='article'){
			var sub1 = document.getElementById('article-tab');
			sub1.click();
		}else if(str=='goods'){
			var sub2 = document.getElementById('goods-tab');
			sub2.click();
		}
	
	}
	
	
	
	function validate()
	
	{
	
	  var validator = new Validator('theForm');
	  var f=document.getElementById('file').value;
	  var fu=document.getElementById('file_url').value;

//	  if(!f&&!fu){
//	  	validator.required('file', no_file);
//	  }
	
	  validator.required('title', no_title);
//	  validator.required('subtitle', no_subtitle);
	  validator.required('description', no_description);
	  validator.required('keywords', no_keywords);
	  
//	  validator.required('description', no_title);
	
	
	
	<?php if ($this->_var['article']['cat_id'] >= 0): ?>
	
	  validator.isNullOption('article_cat',no_cat);
	
	<?php endif; ?>
	
	
	
	
	
	  return validator.passed();
	
	}
	
	
	
	document.getElementById("tabbar-div").onmouseover = function(e)
	
	{
	
	    var obj = Utils.srcElement(e);
	
	
	
	    if (obj.className == "tab-back")
	
	    {
	
	        obj.className = "tab-hover";
	
	    }
	
	}
	
	
	
	document.getElementById("tabbar-div").onmouseout = function(e)
	
	{
	
	    var obj = Utils.srcElement(e);
	
	
	
	    if (obj.className == "tab-hover")
	
	    {
	
	        obj.className = "tab-back";
	
	    }
	
	}
	
	
	
	document.getElementById("tabbar-div").onclick = function(e)
	
	{
	
	    var obj = Utils.srcElement(e);
	
	
	
	    if (obj.className == "tab-front")
	
	    {
	
	        return;
	
	    }
	
	    else
	
	    {
	
	        objTable = obj.id.substring(0, obj.id.lastIndexOf("-")) + "-table";
	
	
	
	        var tables = document.getElementsByTagName("table");
	
	        var spans  = document.getElementsByTagName("span");
	
	
	
	        for (i = 0; i < tables.length; i++)
	
	        {
	
	            if (tables[i].id == objTable)
	
	            {
	
	                tables[i].style.display = (Browser.isIE) ? "block" : "table";
	
	            }
	
	            else
	
	            {
	
	                tables[i].style.display = "none";
	
	            }
	
	        }
	
	        for (i = 0; spans.length; i++)
	
	        {
	
	            if (spans[i].className == "tab-front")
	
	            {
	
	                spans[i].className = "tab-back";
	
	                obj.className = "tab-front";
	
	                break;
	
	            }
	
	        }
	
	    }
	
	}
	
	function original(index){
			document.getElementById("reprinted").style.display="none";
			document.getElementById("code_logo").style.display="none";
			document.getElementById("original").style.display="none";
			document.getElementById('code_logo_img').innerHTML="";
			Ajax.call('article.php?act=original', "is_number="+index, originalResponse, "GET", "JSON");
	}
	
	function originalResponse(result){
		copyright=result;
		var str=location.href;
		var num=str.indexOf("?") ;
		str =str.substr(num+5,4);
		
		var copyright_content="";
			if(result.length){
				document.getElementById("original").style.display="";
			}
			for(var i=0;i<result.length;i++){
				
					if(str=='edit'){
						if(copyright_id==result[i].copyright_id){
						copyright_content +="<input type='radio' onclick='showcopyrightimg("+i+")' checked='ture' name='copyright_id' value='"+result[i].copyright_id+"'/>"+result[i].copyright_content+"<br>";
							showcopyrightimg(i);
						}else{
							copyright_content +="<input type='radio' onclick='showcopyrightimg("+i+")' name='copyright_id' value='"+result[i].copyright_id+"'/>"+result[i].copyright_content+"<br>";
						}
					}else{
							copyright_content +="<input type='radio' onclick='showcopyrightimg("+i+")' name='copyright_id' value='"+result[i].copyright_id+"'/>"+result[i].copyright_content+"<br>";
					}
					
					
//				}
				
			}
			
			document.getElementById('original-content').innerHTML=copyright_content;
//			if(result.original){
//				document.getElementById('original-content').innerHTML=result['original'];
//				document.getElementById('code_logo_img').innerHTML="<img src=\""+result['code_logo']+"\" width=\"180\" height=\"160\">";
//				
//			}else{
//				document.getElementById('original-content').innerHTML=result['reprinted'];
//			}
			
	}
	function showcopyrightimg(i){
		document.getElementById('code_logo_img').innerHTML="";
		if(copyright[i].img_url){
			document.getElementById("code_logo").style.display="";
			document.getElementById('code_logo_img').innerHTML="<img src=\""+copyright[i].img_url+"\" width=\"180\" height=\"160\">";
			
		}else{
			document.getElementById("code_logo").style.display="none";
		}
		if(copyright[i].copyright_replace==1){
			document.getElementById("reprinted").style.display="";
		}else{
			document.getElementById("reprinted").style.display="none";
			document.getElementById('reprinted_name').value="";
		}
		
	}
	
	function showNotice(objId)
	
	{
	
	    var obj = document.getElementById(objId);
	
	
	
	    if (obj)
	
	    {
	
	        if (obj.style.display != "block")
	
	        {
	
	            obj.style.display = "block";
	
	        }
	
	        else
	
	        {
	
	            obj.style.display = "none";
	
	        }
	
	    }
	
	}
	
	  function searchArticle()

  {

    var filters = new Object;



    filters.title = Utils.trim(elements['article_title'].value);



    sz3.loadOptions('get_article_list', filters);

  }
	function getkeyword(m){
		
		var keywords=document.getElementById('keywords').value;
//		var keyword=keywords.split(" ");
//		console.log(keyword);
		var k=0;
		if(keywords){
			console.log(keywords.indexOf(" "+m+" "));
			if(keywords.indexOf(m)==-1){
				document.getElementById('keywords').value=keywords+" "+m;
			}else{
				document.getElementById('keywords').value=keywords;
			}
//			for(var i=0;i<keyword.length;i++){
////				console.log(keyword[i]);
//				if(keyword[i]&&keyword[i]!=m){	
//				 k=1;
//				}
//			}
//			if(k==1){
//				document.getElementById('keywords').value=keywords+" "+m;
//			}
			
			
		}else{
			document.getElementById('keywords').value=" "+m;
		}
		
	}
	
	function searchGoods()
	
	{
	
	    var elements  = document.forms['theForm'].elements;
	
	    var filters   = new Object;
	
	
	
	    filters.cat_id = elements['cat_id'].value;
	
	    filters.brand_id = elements['brand_id'].value;
	
	    filters.keyword = Utils.trim(elements['keyword'].value);
	
	
	
	    sz.loadOptions('get_goods_list', filters);
	
	}
	
	
	
	
	
	/**
	
	 * 选取上级分类时判断选定的分类是不是底层分类
	
	 */
	
	function catChanged()
	
	{
	
	  var obj = document.forms['theForm'].elements['article_cat'];
	
//	  cat_type = obj.options[obj.selectedIndex].getAttribute('cat_type');
	  var cat_type = obj.options[obj.selectedIndex].value;	  
	
	  if (cat_type == undefined)
	
	  {
	
	    cat_type = 1;
	
	  }

		getCatType(cat_type);
	
	  if ((obj.selectedIndex > 0) && (cat_type == 2 || cat_type == 4))
	
	  {
	
	    alert(not_allow_add);
	
	    obj.selectedIndex = 0;
	
	    return false;
	
	  }
	
	
	
	  return true;
	
	}

	function getCatType(typeid)
	{
//		document.getElementById("reprinted").style.display="none";
//		document.getElementById("code_logo").style.display="none";
//		document.getElementById("original").style.display="none";
//		document.getElementById('code_logo_img').innerHTML="";
		Ajax.call('article.php?act=getShowtype', "cat_type="+typeid, showtypeResponse, "GET", "JSON");			
	}
	
	function showtypeResponse(result)
	{
		if (result ==3)
		{
			document.getElementById("video_link").style.display="";												
			document.getElementById("video_url").style.display="";			
		}
		else
		{
			document.getElementById("video_link").style.display="none";									
			document.getElementById("video_url").style.display="none";						
		}
	}
	
	  function addImg(obj)

  {

      var src  = obj.parentNode.parentNode;

//    var idx  = rowindex(src);
      
      var tbl  = document.getElementById('addimg-table');

      var idx = tbl.rows.length-1;

//		alert(tbl.rows.length);

      var row  = tbl.insertRow(idx + 1);

      var cell = row.insertCell(-1);

      cell.innerHTML = src.cells[0].innerHTML.replace(/(.*)(addImg)(.*)(\[)(\+)/i, "$1removeImg$3$4-");

  }
  
    /**

   * 鍒犻櫎鍥剧墖涓婁紶

   */

  function removeImg(obj)

  {

      var row = rowindex(obj.parentNode.parentNode);

      var tbl = document.getElementById('addimg-table');



      tbl.deleteRow(row);

  }
  
   /**

   * 删除图文

   */

  function dropImg(imgId)

  {

    Ajax.call('article.php?is_ajax=1&act=drop_image', "img_id="+imgId, dropImgResp, "GET", "JSON");

  }



  function dropImgResp(result)

  {

      if (result.error == 0)

      {
          document.getElementById('gallery_' + result.content).style.display = 'none';

      }

  }
  
</script>

<?php echo $this->fetch('pagefooter.htm'); ?>